/*
 *ready to proccess the add new page
 **/
$(document).ready(function() {

    $('#passwordUser').val('******');
   /* $('#passwordUser').focus(function()
	{
        $('#passwordUser').val('');
	});*/

	if($('#smtpHost').val().length>0){
			$('#smtpPassword').val('******');
		}else{
			$('#smtpPassword').val('');
		}

    $('.errors').click(function()
    {    $('.errors').hide();  });

    var websiteUrl = $('#website_url').val();

      
    if($('#useSmtp').attr('checked') == true)
    {
        $('#smtpHost').attr('disabled',false);
        $('#smtpPassword').attr('disabled',false);
        $('#smtpLogin').attr('disabled',false);
        
        $('#smtpHost').attr('class','input-text-200');
        $('#smtpPassword').attr('class','input-text-200');
        $('#smtpLogin').attr('class','input-text-200');
    }else
    {
        $('#smtpHost').attr('disabled',true);
        $('#smtpPassword').attr('disabled',true);
        $('#smtpLogin').attr('disabled',true);

        $('#smtpHost').attr('class','input-text-200-disabled');
        $('#smtpPassword').attr('class','input-text-200-disabled');
        $('#smtpLogin').attr('class','input-text-200-disabled')
    }

});

function changeState()
{
   
    if($('#useSmtp').attr('checked') == true)
    {
        $('#smtpHost').attr('disabled',false);
        $('#smtpPassword').attr('disabled',false);
        $('#smtpLogin').attr('disabled',false);

        $('#smtpHost').attr('class','input-text-200');
        $('#smtpPassword').attr('class','input-text-200');
        $('#smtpLogin').attr('class','input-text-200');
		
		if($('#smtpHost').val().length>0){
			$('#smtpPassword').val('******');
		}else{
			$('#smtpPassword').val('');
		}

    }else
    {

        $('#smtpHost').attr('disabled',true);
        $('#smtpPassword').attr('disabled',true);
        $('#smtpLogin').attr('disabled',true);


        $('#smtpHost').attr('class','input-text-200-disabled');
        $('#smtpPassword').attr('class','input-text-200-disabled');
        $('#smtpLogin').attr('class','input-text-200-disabled')
		$('#smtpPassword').val('');
    }
}